const {
	Controller
} = require('uni-cloud-router')
const {
	success,
	exception,
	error,
	typeOf,
} = require("lg-utils")
module.exports = class StockController extends Controller {

	/***
		 @type GET 
		 @description : 新增/更新基金基本信息集合
	     @param {}
	***/

	async addStockBaseInfoList() {
		try {
			const {
				data,
				service
			} = this.ctx;
			return await service.stock.addStockBaseInfoList();
		} catch (e) {
			return exception(this, "新增/更新基金基本信息集合异常;", e);
		}
	}
	/***
		 @type GET 
		 @description : 捕获基金基本信息列表
	     @param {
			 nodeList = ["sh_a", "sz_a", "sh_b", "sz_b"], 	不同市场，类型股票标识
			 pageSize = 100   								单页数据项大小
	***/

	async catchStockBaseInfoList() {
		try {
			const {
				data,
				service
			} = this.ctx;
			return await service.stock.catchStockBaseInfoList(data);
		} catch (e) {
			return exception(this, "捕获基金基本信息列表异常;", e);
		}
	}


	async addStockLines() {

		try {
			const {
				data,
				service
			} = this.ctx;
			return await service.stock.addStockLines();
		} catch (e) {
			return exception(e, this);
		}


	}
	async removeAllKLine() {

		try {
			const {
				data,
				service
			} = this.ctx;
			return await service.stock.removeAllKLine();
		} catch (e) {
			return exception(e, this);
		}


	}
	async updateDayLine() {

		try {
			const {
				data,
				service
			} = this.ctx;
			return await service.stock.updateDayLine();
		} catch (e) {
			return exception(e, this);
		}


	}
	async test() {

		try {
			const {
				data,
				service
			} = this.ctx;
			return await service.stock.test();
		} catch (e) {
			return exception(e, this);
		}


	}


}
